    
    require 'tolua.reflection'          
    tolua.loadassembly('Assembly-CSharp')
    tolua.loadassembly('mscorlib')         
    local BindingFlags = require 'System.Reflection.BindingFlags'

    function DoClick()
        print('do click')        
    end 

    function Test()  
        local t = typeof('TestExport')        
        local func = tolua.getmethod(t, 'TestReflection')           
        func:Call()        
        func:Destroy()
        func = nil
        
        local objs = {Vector3.one, Vector3.zero}
        local array = tolua.toarray(objs, typeof(Vector3))
        local obj = tolua.createinstance(t, array)
        --local constructor = tolua.getconstructor(t, typeof(Vector3):MakeArrayType())
        --local obj = constructor:Call(array)        
        --constructor:Destroy()
        print('obj',obj)

        func = tolua.getmethod(t, 'Test', typeof('System.Int32'):MakeByRefType())        
        local r, o = func:Call(obj, 123)
        print('1__________' .. r..':'..o)
        func:Destroy()
        
        print('||||||||||')
        local p = tolua.getproperty(t, 'Str')
        print(p)
        local num = p:Get(null,null)
        print('3_________')
        print(num)
        p:Destroy()

        print(null == nil)
        print('null',null)

        local Debug = typeof('UnityEngine.Debug')
        local log = tolua.getproperty(Debug, 'logger')
        print("log",log)
        local ILogger = typeof('UnityEngine.ILogger')
        local log_p = tolua.getproperty(ILogger,'logEnabled')
        print("log_p",log_p)
        local val = log_p:Get(log,null)
        print(val)

 
        local property = tolua.getproperty(t, 'Number')
        local num = property:Get(obj, null)
        print('object Number: '..num)
        property:Set(obj, 456, null)
        num = property:Get(obj, null)
        property:Destroy()
        print('object Number: '..num)

        local field = tolua.getfield(t, 'field')
        num = field:Get(obj)
        print('object field: '.. num)
        field:Set(obj, 2048)
        num = field:Get(obj)
        field:Destroy()
        print('object field: '.. num)       
        
        field = tolua.getfield(t, 'OnClick')
        local onClick = field:Get(obj)        
        onClick = onClick + DoClick        
        field:Set(obj, onClick)        
        local click = field:Get(obj)
        click:DynamicInvoke()
        field:Destroy()
        click:Destroy()
    end  
